﻿using _1_Interfaces.Interfaces.Cjw;
using _1_Interfaces.Models.Tables.Cjw;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace _3_Controllers.Controllers.Cjw
{
    /// <summary>
    /// 科室管理
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class CjwDepartmentController : ControllerBase
    {
        private IDepartmentService _departmentService;
        public CjwDepartmentController(IDepartmentService departmentService)
        {
            _departmentService = departmentService;
        }

        /// <summary>
        /// 获取科室列表
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public List<DepartmentList> GetDepartmentList()
        {
            return _departmentService.GetDepartmentList();
        }

        /// <summary>
        /// 新增科室
        /// </summary>
        /// <param name="departmentList"></param>
        /// <returns></returns>
        [HttpPost]
        public bool AddDepartment(DepartmentList departmentList)
        {
            return _departmentService.AddDepartment(departmentList);
        }

        /// <summary>
        /// 删除科室
        /// </summary>
        /// <param name="departmentId">科室id</param>
        /// <returns></returns>
        [HttpGet]
        public bool DelDepartment(int departmentId)
        {
            return _departmentService.DelDepartment(departmentId);
        }
    }
}
